package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entity.Dept;
import com.atguigu.springcloud.service.IDeptService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author : wenchao.long
 * @date : Created in 2020/12/08 13:43 周二
 * @description :
 */
@RestController
@AllArgsConstructor
public class DeptController {

    private final IDeptService deptService;

    @PostMapping("/dept/add")
    public Boolean add(@RequestBody Dept dept) {
        return deptService.add(dept);
    }

    @GetMapping("/dept/get/{id}")
    public Dept findOne(@PathVariable("id") Long id) {
        return deptService.findOne(id);
    }

    @GetMapping("/dept/list")
    public List<Dept> findAll() {
        return deptService.findAll();
    }

}
